<template>
  <div class="app-container">
    <!--  个人中心部分-->
    <div style="">
      <div style="padding-top: 10px">
        <h3 style="text-align: center;margin-top: 0">个人中心</h3>
      </div>

      <div class="url-flex">
        <!--      头像-->
        <div>
          <div class="block">
            <el-avatar shape="square" :size="50" :src="squareUrl"></el-avatar>
          </div>
        </div>
        <!--      昵称-->
        <div style="display: flex; align-items: center;font-size: 14px;font-weight: 700;margin-left: 20px">
<!--          {{userInfo.user.nickName}}-->
        </div>
      </div>
      <!--      信息盒子-->
      <div class="info-box">
        <div>
          <div class="weight-font"> {{userInfo.user.nickName}}</div>
          <div>真实名称</div>
        </div>
        <div>
          <div  class="weight-font">{{userInfo.user.deptName}}</div>
          <div>所属部门</div>
        </div>
        <div>
          <div  class="weight-font">{{userInfo.user.remark || '暂无内容'}}</div>
          <div>用户角色</div>
        </div>
      </div>
      <!--      标签-->
<!--      <div class="tag-box">-->
        <!--       单个盒子-->
<!--        <div class="tag-item-box" @click="pastExam">-->
<!--          <div>往期考试</div>-->
<!--          <div>-->
<!--            <img src="@/assets/right.png" alt="" srcset="">-->
<!--          </div>-->
<!--        </div>-->
<!--        <div class="tag-item-box layout-box" style="background-color: white;display: flex;justify-content: space-between" @click="pastExam">-->
<!--          <div>往期考试</div>-->
<!--          <div>-->
<!--            <img src="@/assets/right.png" alt="" srcset="">-->
<!--          </div>-->
<!--        </div>-->
<!--      </div>-->



      <div class="tag-item-box layout-box" style="background-color: white;display: flex;justify-content: space-between" @click="myExam">
        <div>我的考试</div>
        <div>
          <img src="@/assets/right.png" alt="" srcset="">
        </div>
      </div>

      <div class="tag-item-box layout-box" style="background-color: white;display: flex;justify-content: space-between" @click="pastExam">
        <div>往期考试</div>
        <div>
          <img src="@/assets/right.png" alt="" srcset="">
        </div>
      </div>

      <div class="tag-item-box layout-box" style="background-color: white;display: flex;justify-content: space-between" @click="loyOut">
        <div>退出登录</div>
        <div>
          <img src="@/assets/right.png" alt="" srcset="">
        </div>
      </div>
    </div>
  </div>
</template>
<script>
import {logout} from "@/api/login";

export default {
  name: "indexPage",
  data() {
    return {
      squareUrl: "https://cube.elemecdn.com/9/c2/f0ee8a3c7c9638a54940382568c9dpng.png",
      sizeList: ["large", "medium", "small"],
      userInfo: {}
    }
  },
  created() {
    this.getUsernameinfo()
  },
  methods: {
    getUsernameinfo() {
      localStorage.getItem('examuserInfo')
      this.userInfo = JSON.parse(localStorage.getItem('examuserInfo'))
      console.log(this.userInfo)
    },
    //我的考试入口
    myExam() {
      this.$router.push({
        path: '/myExam'
      })
    },
    //往期考试入口
    pastExam() {
      this.$router.push({
        path: '/pastExam'
      })
    },
  //   退出登录
    loyOut(){
      let data = localStorage.getItem('examuserInfo')
      logout(data).then(res=>{
        this.$message({
          message: res.msg,
          type: 'success'
        });
      })
      this.$router.push('/')
    }
  }
}
</script>
<style scoped>
.app-container {
  height: 100vh;
  background-color: #eff3f7;
  font-size: 14px;
  color: #333;
  font-family: Helvetica Neue, Helvetica, sans-serif;
}

.url-flex {
  padding: 0 30px 30px 30px;
  display: flex;
}

.info-box {
  padding: 20px 0;
  margin-bottom: 10px;
  background-color: white;
  display: flex;
  justify-content: space-around;

  div {
    text-align: center;
  }
}

.tag-box {
  background-color: white;

  .tag-item-box {
    padding: 10px 10px;
    border-bottom: 1px solid #d8d8d8;
    display: flex;
    justify-content: space-between;
  }
}

.layout-box {
  margin: 10px 0;
  padding: 15px 10px;
}
.weight-font{
  font-size: 14px;
  font-weight: 700;
}
</style>
